import Vue from 'vue'
import VueRouter from 'vue-router'
import layoutView from '../views/layout/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../components/login.vue')
  },
  {
    path: '/home',
    name: 'home',
    component: layoutView,
    children: [
      {
        path: '/overView',
        name: 'overView',
        component: () => import( '../views/overView/index.vue')
      },
      {
        path: '/building',
        name: 'building',
        component: () => import( '../views/building/index.vue')
      },
      {
        path: '/dormitory',
        name: 'dormitory',
        component: () => import( '../views/dormitory/index.vue')
      },
      {
        path: '/student',
        name: 'student',
        component: () => import( '../views/student/index.vue')
      },
      {
        path: '/worker',
        name: 'worker',
        component: () => import( '../views/worker/index.vue')
      },
      {
        path: '/evaluation',
        name: 'evaluation',
        component: () => import( '../views/evaluation/index.vue')
      },
      {
        path: '/maintenance',
        name: 'maintenance',
        component: () => import( '../views/maintenance/index.vue')
      },
      {
        path: '/notice',
        name: 'notice',
        component: () => import( '../views/notice/index.vue')
      },
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
